package com.veritech.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;

import org.springframework.jdbc.core.RowMapper;

import com.veritech.model.Service;

public class ServiceMapper implements RowMapper<Service> {

	//private SimpleDateFormat sdformat = new SimpleDateFormat("dd/MM/yyyy");
	
	public Service mapRow(ResultSet rs, int arg1) throws SQLException {
		Service service = new Service();
		service.setId(rs.getLong("id"));
		service.setName(rs.getString("name"));
		service.setCreatedDate(rs.getDate("createdDate"));
		service.setDescription(rs.getString("description"));
		service.setActive(rs.getShort("active")==0?false:true);
		return service;
	}

}
